# -*- coding: utf-8 -*-
# author yzs
# date 2018-12-29

# 点的凸包
# Description
# Convex Hull of a set of points, in 2D plane, is a convex polygon with minimum area such that each point lies either on
# the boundary of polygon or inside it. Now given a set of points the task is to find the convex hull of points.
# Input
# The first line of input contains an integer T denoting the num of test cases. Then T test cases follow.
# Each test case contains an integer N denoting the num of points.
# Then in the next line are N*2 space separated values denoting the points ie x and y.Constraints:1<=T<=100,1<=N<=100,1<=x,y<=1000
# Output
# For each test case in a new line print the points x and y of the convex hull separated by a space in sorted order
# where every pair is separated from the other by a ','. If no convex hull is possible print -1.
# Sample Input 1 
# 2
# 3
# 1 2 3 1 5 6
# 3
# 1 2 4 4 5 1
# Sample Output 1
# 1 2, 3 1, 5 6
# 1 2, 4 4, 5 1

def deal_left(first, final, list, temp):
    # temp用来标记位于凸包上的点
    max = 0
    index = -1
    # 处理first到final的上方，得到使first，final，i 三点组成的三角形面积最大的点i
    if first < final:
        for i in range(first, final):
            first_coordinate = list[first]
            final_coordinate = list[final]
            i_coordinate = list[i]
            first_x = first_coordinate[0]
            first_y = first_coordinate[1]
            final_x = final_coordinate[0]
            final_y = final_coordinate[1]
            i_x = i_coordinate[0]
            i_y = i_coordinate[1]
            # 计算first，final，i 三点组成的三角形面积
            triangle_area = first_x * final_y + i_x * first_y + final_x * i_y - i_x * final_y - final_x * first_y - first_x * i_y
            if triangle_area > max:
                max = triangle_area
                index = i
    # 处理first到final的下方，得到使first，final，i 三点组成的三角形面积最大的点i
    else:
        for i in range(final, first):
            first_coordinate = list[first]
            final_coordinate = list[final]
            i_coordinate = list[i]
            first_x = first_coordinate[0]
            first_y = first_coordinate[1]
            final_x = final_coordinate[0]
            final_y = final_coordinate[1]
            i_x = i_coordinate[0]
            i_y = i_coordinate[1]
            triangle_area = first_x * final_y + i_x * first_y + final_x * i_y - i_x * final_y - final_x * first_y - first_x * i_y
            if triangle_area > max:
                max = triangle_area
                index = i
    if index != -1:
        temp[index] = 1
        deal_left(first, index, list, temp)
        deal_left(index, final, list, temp)


def divide_convex_hull(list, n):
    temp = {}
    list_convex_new = []
    if n == 3:
        return list
    for i in range(n):
        temp[i] = 0
        lis_con = list
        lis_con.sort()
        temp[0] = 1
        temp[n - 1] = 1
        deal_left(0, n - 1, lis_con, temp)
        deal_left(n - 1, 0, lis_con, temp)
    for i in temp:
        if temp[i] == 1:
            list_convex_new.append(lis_con[i])
    return list_convex_new


t = int(input().strip())
for i in range(t):
    num = int(input().strip())
    point_arr = []
    line = list(map(int, input().strip().split()))
    for j in range(num):
        point_arr.append((line[j * 2], line[2 * j + 1]))
    result = divide_convex_hull(point_arr, len(point_arr))
    result.sort(key=lambda x: x[0])
    ans = ''
    for j in range(len(result)):
        ans += str(result[j][0]) + ' ' + str(result[j][1]) + ', '
    print(ans.strip()[:-1])
